namespace yiCommerce.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class label_related : DbMigration
    {
        public override void Up()
        {
         
            
            CreateTable(
                "dbo.Status_Tag_Mapping",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        StatusId = c.Int(nullable: false),
                        TagId = c.Int(nullable: false),
                        DisplayOrder = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Statuses", t => t.StatusId, cascadeDelete: true)
                .ForeignKey("dbo.Tags", t => t.TagId, cascadeDelete: true)
                .Index(t => t.StatusId)
                .Index(t => t.TagId);
            
            CreateTable(
                "dbo.Tags",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        TagName = c.String(),
                        TagValue = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            

        }

        public override void Down()
        {


            DropIndex("dbo.Status_Tag_Mapping", new[] {"TagId"});
            DropIndex("dbo.Status_Tag_Mapping", new[] {"StatusId"});

            DropForeignKey("dbo.Status_Tag_Mapping", "TagId", "dbo.Tags");
            DropForeignKey("dbo.Status_Tag_Mapping", "StatusId", "dbo.Statuses");

            DropTable("dbo.Tags");
            DropTable("dbo.Status_Tag_Mapping");
        }
    }
}
